package com.company;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author 关敬元
 * @Description Map遍历方式
 * @date 2019/11/28
 */
public class QuerMap {
    public static void main(String[] args) {
        Map map=new HashMap();

        map.put("CN","中华人民共和国");
        map.put("US","美利坚合众国");
        map.put("RU","俄罗斯联邦共和国");
        map.put("FR","法兰西共和国");
        Set keys = map.keySet();
        Collection values=map.values();
        for (Object obj:keys){
            System.out.println("map的键有："+obj);
        }
        for (Object obj:values) {
            System.out.println("map的值有：" + obj);
        }
        Set key_values=map.entrySet();
        for (Object obj:key_values){
            System.out.println("map的映射有："+obj);
        }

    }
}
